package lab02.Test30;

/**
 * Created by lenovo on 2017/11/14.
 */
import java.util.*;
public class Grade
{
    static double average;
    public static void main(String[] args)

    {

        double markIn;
        Scanner sc=new Scanner(System.in);

        List<Double> marks=new ArrayList<Double>();

        do

        {

            System.out.print("请输入一名学生成绩[输入负数结束]:");

            markIn=sc.nextDouble();

            marks.add(markIn);

        }

        while(markIn>=0);

        int len=marks.size()-1;

        marks.remove(len);

        for(int i=0;i<len;i++)

        {

            average+=marks.get(i)/len;

        }

        System.out.print(len+"名学生成绩的平均分为:"+average);

    }

}